use serde::{Deserialize, Serialize};
use uuid::Uuid;
use sqlx::FromRow;

// #[derive(Serialize, Deserialize)]
// pub struct User {
//     pub id: Uuid,
//     pub username: String,
//     pub password_hash: String,
// }

// #[derive(Serialize, Deserialize)]
// pub struct UploadFileRequest {
//     pub filename: String,
// }

// #[derive(Serialize, Deserialize)]
// pub struct Music {
//     pub title: String,
//     pub artist: String,
//     pub file_path: String,
// }

//相关词汇：编曲 - Arranger， 制作人 - Producer， 发行公司 - Record Label， 时长 - Duration，音轨号 - Track Number

#[derive(Default, Debug, Serialize, Deserialize, FromRow)]
pub struct SongMetaInfo {
    #[serde(default)]
    pub song_id: i64,

    pub title: String,  // 歌曲名 Song Title
    pub artist: String, // 演唱 Singer 
    pub lyricist: String, // 作词 Lyricist
    pub composer: String,   // 作曲 Composer
    pub album: String, // 专辑 Album
    pub genre: String, // 类型 Genre
    pub lyrics:String, // 歌词 Lyrics
    pub release_date: chrono::NaiveDate, // 发行日期
    pub file_path: String, // 文件路径

    #[serde(default)]
    pub created_at: chrono::NaiveDateTime, // 创建时间
    #[serde(default)]
    pub updated_at: chrono::NaiveDateTime, // 更新时间
}

#[derive(Deserialize)]
pub struct UploadSongRequest {
    pub song_meta_info: SongMetaInfo,
    pub url: String, // 从这个url下载文件后穿给服务器
}

// #[derive(Serialize, Deserialize)]
// pub struct Playlist {
//     pub id: Uuid,
//     pub user_id: Uuid,
//     pub name: String,
//     pub music_ids: Vec<Uuid>,
// }

#[derive(Deserialize, Debug)]
pub struct LoginRequest {
    pub username: String,
    pub password: String,
}

// #[derive(Deserialize)]
// pub struct CreatePlaylistRequest {
//     pub name: String,
//     pub music_ids: Vec<Uuid>,
// }

// #[derive(Deserialize)]
// pub struct SearchParams {
//     pub query: String,
// }

#[derive(Serialize)]
pub struct SuccessResponse<T> {
    pub code: u16,
    pub message: String,
    pub data: T,
}

#[derive(Serialize)]
pub struct ErrorResponse {
    pub code: u16,
    pub message: String,
    pub error: String,
}